package common;

/**
 * This class clones any matrix it gets
 */
public class CloneMatrix {
	
	/**
	 * CTOR
	 * @param matrix array
	 * @return the cloned matrix
	 */
	public static int[][] clone(int[][] matrix) {
	    if (matrix == null)
	        return null;
	    
	    int[][] cloned = new int[matrix.length][];
	    
	    for (int r = 0; r < matrix.length; r++) {
	    	cloned[r] = matrix[r].clone();
	    }
	    
	    return cloned;
	}
}
